package com.project.pet.config;


import cn.hutool.core.io.FileUtil;
import com.project.pet.common.Constant;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class WebConfig implements WebMvcConfigurer {

    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        FileUtil.mkdir(Constant.FILE_HOME);
        registry.addResourceHandler(Constant.FILE_URL_PREFIX+"**").addResourceLocations("file:" + Constant.FILE_HOME);
    }
}

